Add certificate profile validation against C2PA schemas#8
Closed
erik-sv wants to merge 27 commits into
Closed
Conversation
initial app based on codex + cursor revisions
- Updated README to clarify validation capabilities, output formats, and usage examples. - Changed default trust mode from 'official' to 'default' in launch configurations. - Improved CLI argument handling for trust modes and output options. - Removed unused profile handling code and related structures to streamline validation process. - Added licensing information to source files for compliance.
Enhance README and CLI functionality for C2PA validation tool
- Added new dependencies including `jsonschema`, `ahash`, `bit-set`, and others to improve validation capabilities. - Introduced `run_with_cli` function for better CLI argument handling in tests. - Updated `InputType` enum to derive `Copy` and `PartialEq` for improved comparison. - Enhanced test coverage for output path normalization and report rendering. - Updated `CONTRIBUTING.md` to include testing instructions.
Update dependencies and enhance validation functionality
- Enhanced the logic for writing output files when a profile is used, ensuring both crJSON and profile evaluation reports are generated. - Improved directory creation and error handling for output paths. - Updated the `write_structured_per_asset` function to streamline asset report writing. - Adjusted output file naming conventions to prevent collisions and ensure clarity in report generation.
Profile evaluation
Improved reports
…ring (contentauth#6) - Introduced new launch configurations for validating multiple assets and specific ChatGPT images with generative AI profiles in VSCode. - Updated report rendering functions to accept a profile-only flag, allowing for tailored output in Markdown and HTML formats. - Enhanced Markdown and HTML reports with emoji indicators for better readability and categorization. - Adjusted test cases to reflect changes in report rendering logic.
Add full rubric evaluation pipeline for the C2PA asset conformance program's composable rubric framework. json-formula-rs: - Add normalize_expression() for bare true/false/null keyword rewriting - Add arg_count() helper and $argN parameterized named expression support in register_expression() with globals injection and save/restore pattern profile-evaluator-rs: - Add evaluate_rubric_conformance() for whole-crJSON conformance evaluation with failIfMatched support and true/false trait bucketing - Add evaluate_rubric_signals() for per-manifest signal detection with inception/transformation grouping, ingredient index resolution, assertedBy extraction, and mimeType derivation - Support both report_text (profiles) and reportText (rubrics) field names - 36 golden fixture tests matching upstream Python reference evaluator output (1 documented deviation: startsWith array projection in ii2i) c2pa-validate CLI: - Add -rubric, -rubric-dir, -rubric-mode (conformance/signals), -emit-crjson, -crjson, -rubric-strict flags - Remove crJSON evaluation bail that blocked rubric eval on crJSON inputs - Add rubric_results to CrJsonValidationReport for structured output Test fixtures: - 5 rubric YAML files from c2pa-org/conformance PR #324 - 18 golden test scenarios (54 files) from upstream test suite
When --rubric is used with binary assets, the CLI now extracts crJSON and runs rubric evaluation even when trust verification fails. This supports the conformance program onboarding workflow where products use self-signed certificates before receiving program-issued certs. The pipeline attempts trust verification first, then falls back to reading with verify_trust disabled. The crJSON validationResults still reflect the untrusted state, so the trusted_success trait fails as expected while all other conformance traits can be evaluated. Also fix structured JSON output for CrJsonValidation report items so rubric results are properly serialized instead of null.
…andling Move $argN injection and bare-keyword normalization from json-formula-rs to profile-evaluator-rs. This keeps json-formula-rs upstream-compatible while supporting parameterized named expressions in rubric evaluation. json-formula-rs retains only register_function() and globals_mut() as additions over upstream. All expression preprocessing now runs in the evaluator layer at registration time.
…chemas Add --cert-profile, --cert-schema, and --emit-cert-json CLI flags for validating X.509 certificates against the C2PA conformance program's certificate profile JSON schemas. The new cert_profile module parses PEM/DER certificates using x509-parser, serializes them to the JSON format expected by the schemas (including _pyasn1_decoded for custom C2PA extensions), and validates against Draft 2020-12 JSON Schema. Supports all four C2PA certificate profiles: root CA, claim signing issuing CA, claim signing leaf (AL1), and OCSP responder leaf. Bump version to 0.4.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
--cert-profile,--cert-schema, and--emit-cert-jsonCLI flags for validating X.509 certificates against the C2PA conformance program's certificate profile JSON schemas.The conformance program defines four certificate profiles: root CA, claim signing issuing CA, claim signing leaf (AL1), and OCSP responder leaf. Each profile has a JSON schema that specifies required extensions, key usage constraints, and naming conventions. Validating a certificate against these schemas before submission catches profile violations early.
The new
cert_profilemodule:x509-parser._pyasn1_decodedrepresentations of custom extensions (Authority Information Access, CRL Distribution Points, Subject Alternative Name).jsonschemacrate.Depends on #7 for shared CLI infrastructure.
Usage
Test plan
cargo test cert_profilepasses for all integration tests--emit-cert-jsonproduces valid JSON matching the schema's expected structure